﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ArtemisExtensions
{
    /// <summary>
    /// Singleton. Manages the use of all ContainingEntity Systems
    /// </summary>
    /// <remarks>Schedules the activation of ESs</remarks>
    public sealed class EntitySystemManager : ArtemisExtensions.IEntitySystemManager
    {

        private EntitySystemManager instance;

        public EntitySystemManager Instance
        {
            get
            {
                if (instance == null)
                {
                    instance = new EntitySystemManager();
                }
                return instance;
            }
        }

        private EntitySystemManager() { }

        public Universe Universe
        {
            get;
            set;
         }

        /// <summary>
        /// List of all Actor Systems
        /// </summary>
        /// <remarks>Contained in ordered list - ES checked and updated in order</remarks>
        public List<EntitySystem> EntitySystemList
        {
            get;
            private set;
        }

        public SupportingEntitySystemManager SupportingEntitySystem
        {
            get
            {
                throw new System.NotImplementedException();
            }
            set
            {
            }
        }

        public void Update()
        {
            foreach (EntitySystem es in EntitySystemList)
            {
                
                es.Update();
                
            }

        }
    }


}
